com.cete.dynamicpdf
Class Page
Example : The following example creates a new page using a PageDimensions to set the margins of that page.
It then places a label on the page and rotates the page 90 degrees.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.*;
public class MyClass {
public static void main(String args[]) {
// Create a PDF Document
Document document = new Document();
// Create a page dimensions object and set the margins
PageDimensions dimensions = new PageDimensions( PageSize.LETTER, PageOrientation.PORTRAIT );
dimensions.setBottomMargin(50);
dimensions.setTopMargin(50);
dimensions.setLeftMargin(35);
dimensions.setRightMargin(35);
// Create a page using a page dimensions object and add it to the document
Page page = new Page( dimensions );
document.getPages().add( page );
// Add a label to the page
page.getElements().add( new Label( "This page was rotated 90 degrees.", 0, 0, 300, 20, Font.getHelvetica(), 18 ) );
// Rotate the page 90 degrees
page.setRotate(90);
// Save the PDF
document.draw( "[physicalpath]/MyDocument.pdf" );
}
}